<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.18"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>embedme: libemb::NetUtil Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">embedme
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>libemb</b></li><li class="navelem"><a class="el" href="classlibemb_1_1_net_util.html">NetUtil</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="classlibemb_1_1_net_util-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">libemb::NetUtil Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>网络工具类,提供对网络设别的常用操作.  
 <a href="classlibemb_1_1_net_util.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_net_util_8h_source.html">NetUtil.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a6fcc0212b4788d7c84b1d530b8e7cd51"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#a6fcc0212b4788d7c84b1d530b8e7cd51">isValidIP</a> (const std::string ip)</td></tr>
<tr class="memdesc:a6fcc0212b4788d7c84b1d530b8e7cd51"><td class="mdescLeft">&#160;</td><td class="mdescRight">判断是否是合法IP  <a href="classlibemb_1_1_net_util.html#a6fcc0212b4788d7c84b1d530b8e7cd51">More...</a><br /></td></tr>
<tr class="separator:a6fcc0212b4788d7c84b1d530b8e7cd51"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0e7a71af2ed0868ac32d4daa40980bfa"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#a0e7a71af2ed0868ac32d4daa40980bfa">checkSubnetIP</a> (const std::string gatewayIP, const std::string subnetMask, std::string &amp;subnetIP)</td></tr>
<tr class="memdesc:a0e7a71af2ed0868ac32d4daa40980bfa"><td class="mdescLeft">&#160;</td><td class="mdescRight">校验子网IP  <a href="classlibemb_1_1_net_util.html#a0e7a71af2ed0868ac32d4daa40980bfa">More...</a><br /></td></tr>
<tr class="separator:a0e7a71af2ed0868ac32d4daa40980bfa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0d989b9d5c1a2f7a52e54cfa7452b297"><td class="memItemLeft" align="right" valign="top">static std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#a0d989b9d5c1a2f7a52e54cfa7452b297">getSubnetIP</a> (const std::string gatewayIP, const std::string subnetMask, int subIndex)</td></tr>
<tr class="memdesc:a0d989b9d5c1a2f7a52e54cfa7452b297"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取子网IP  <a href="classlibemb_1_1_net_util.html#a0d989b9d5c1a2f7a52e54cfa7452b297">More...</a><br /></td></tr>
<tr class="separator:a0d989b9d5c1a2f7a52e54cfa7452b297"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a488d0c73136bcf3f489b57096d5bfb2b"><td class="memItemLeft" align="right" valign="top">static std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#a488d0c73136bcf3f489b57096d5bfb2b">getInetAddr</a> (const std::string intf)</td></tr>
<tr class="memdesc:a488d0c73136bcf3f489b57096d5bfb2b"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取网口ip地址  <a href="classlibemb_1_1_net_util.html#a488d0c73136bcf3f489b57096d5bfb2b">More...</a><br /></td></tr>
<tr class="separator:a488d0c73136bcf3f489b57096d5bfb2b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad4bdfc20f3cc038fef56aba30899fd7e"><td class="memItemLeft" align="right" valign="top">static std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#ad4bdfc20f3cc038fef56aba30899fd7e">getMaskAddr</a> (const std::string intf)</td></tr>
<tr class="memdesc:ad4bdfc20f3cc038fef56aba30899fd7e"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取网口子网掩码地址  <a href="classlibemb_1_1_net_util.html#ad4bdfc20f3cc038fef56aba30899fd7e">More...</a><br /></td></tr>
<tr class="separator:ad4bdfc20f3cc038fef56aba30899fd7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a686ec370867d03c670eff586287acd38"><td class="memItemLeft" align="right" valign="top">static std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#a686ec370867d03c670eff586287acd38">getMacAddr</a> (const std::string intf)</td></tr>
<tr class="memdesc:a686ec370867d03c670eff586287acd38"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取网口mac地址  <a href="classlibemb_1_1_net_util.html#a686ec370867d03c670eff586287acd38">More...</a><br /></td></tr>
<tr class="separator:a686ec370867d03c670eff586287acd38"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeab3247907bbacb5fb3ead4b5cf1a758"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="_net_util_8h.html#aa652d8a6638e8367e3aa0c8c005f847a">NetHwState</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#aeab3247907bbacb5fb3ead4b5cf1a758">getHwState</a> (const std::string intf)</td></tr>
<tr class="memdesc:aeab3247907bbacb5fb3ead4b5cf1a758"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取网口状态  <a href="classlibemb_1_1_net_util.html#aeab3247907bbacb5fb3ead4b5cf1a758">More...</a><br /></td></tr>
<tr class="separator:aeab3247907bbacb5fb3ead4b5cf1a758"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa56ecf7efb5269453a0957c83ba0203c"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="_net_util_8h.html#a30af18f263a539852711bbd271e9a9d8">NetLinkState</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#aa56ecf7efb5269453a0957c83ba0203c">getLinkState</a> (const std::string intf)</td></tr>
<tr class="memdesc:aa56ecf7efb5269453a0957c83ba0203c"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取网络连接状态  <a href="classlibemb_1_1_net_util.html#aa56ecf7efb5269453a0957c83ba0203c">More...</a><br /></td></tr>
<tr class="separator:aa56ecf7efb5269453a0957c83ba0203c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a03ad01a91fa4506495d13a2e1f1df927"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#a03ad01a91fa4506495d13a2e1f1df927">setInetAddr</a> (const std::string intf, const std::string ipaddr)</td></tr>
<tr class="memdesc:a03ad01a91fa4506495d13a2e1f1df927"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置网口IP  <a href="classlibemb_1_1_net_util.html#a03ad01a91fa4506495d13a2e1f1df927">More...</a><br /></td></tr>
<tr class="separator:a03ad01a91fa4506495d13a2e1f1df927"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4bb38b696c79d1d00e28397efb50ad60"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#a4bb38b696c79d1d00e28397efb50ad60">setMaskAddr</a> (const std::string intf, const std::string netmask)</td></tr>
<tr class="memdesc:a4bb38b696c79d1d00e28397efb50ad60"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置子网掩码  <a href="classlibemb_1_1_net_util.html#a4bb38b696c79d1d00e28397efb50ad60">More...</a><br /></td></tr>
<tr class="separator:a4bb38b696c79d1d00e28397efb50ad60"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07625066943cbfa53a6ce1bfbcb03924"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#a07625066943cbfa53a6ce1bfbcb03924">setMacAddr</a> (const std::string intf, const std::string mac)</td></tr>
<tr class="memdesc:a07625066943cbfa53a6ce1bfbcb03924"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置MAC地址  <a href="classlibemb_1_1_net_util.html#a07625066943cbfa53a6ce1bfbcb03924">More...</a><br /></td></tr>
<tr class="separator:a07625066943cbfa53a6ce1bfbcb03924"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4072f4022df07fafd6627fbb250f444b"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#a4072f4022df07fafd6627fbb250f444b">setHwState</a> (const std::string intf, <a class="el" href="_net_util_8h.html#aa652d8a6638e8367e3aa0c8c005f847a">NetHwState</a> state)</td></tr>
<tr class="memdesc:a4072f4022df07fafd6627fbb250f444b"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置网口状态  <a href="classlibemb_1_1_net_util.html#a4072f4022df07fafd6627fbb250f444b">More...</a><br /></td></tr>
<tr class="separator:a4072f4022df07fafd6627fbb250f444b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2021b10ef7684c18ea9a14a7672158c0"><td class="memItemLeft" align="right" valign="top">static std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classlibemb_1_1_net_util.html#a2021b10ef7684c18ea9a14a7672158c0">getHostIP</a> (const std::string &amp;hostName)</td></tr>
<tr class="memdesc:a2021b10ef7684c18ea9a14a7672158c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取域名对应的IP  <a href="classlibemb_1_1_net_util.html#a2021b10ef7684c18ea9a14a7672158c0">More...</a><br /></td></tr>
<tr class="separator:a2021b10ef7684c18ea9a14a7672158c0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>网络工具类,提供对网络设别的常用操作. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a0e7a71af2ed0868ac32d4daa40980bfa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0e7a71af2ed0868ac32d4daa40980bfa">&#9670;&nbsp;</a></span>checkSubnetIP()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool libemb::NetUtil::checkSubnetIP </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>gatewayIP</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>subnetMask</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::string &amp;&#160;</td>
          <td class="paramname"><em>subnetIP</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>校验子网IP </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">gatewayIP</td><td></td></tr>
    <tr><td class="paramname">subnetMask</td><td></td></tr>
    <tr><td class="paramname">subnetIP</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true </dd>
<dd>
false </dd></dl>

</div>
</div>
<a id="a2021b10ef7684c18ea9a14a7672158c0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2021b10ef7684c18ea9a14a7672158c0">&#9670;&nbsp;</a></span>getHostIP()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string libemb::NetUtil::getHostIP </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>hostName</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取域名对应的IP </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">hostName</td><td>主机域名 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>std::string IP地址(如果域名带端口号,端口号一并返回) </dd></dl>

</div>
</div>
<a id="aeab3247907bbacb5fb3ead4b5cf1a758"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeab3247907bbacb5fb3ead4b5cf1a758">&#9670;&nbsp;</a></span>getHwState()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_net_util_8h.html#aa652d8a6638e8367e3aa0c8c005f847a">NetHwState</a> libemb::NetUtil::getHwState </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>intf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取网口状态 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">intf</td><td>网口名称,如eth0 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>NetHwState 成功返回网口状态 </dd></dl>

</div>
</div>
<a id="a488d0c73136bcf3f489b57096d5bfb2b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a488d0c73136bcf3f489b57096d5bfb2b">&#9670;&nbsp;</a></span>getInetAddr()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string libemb::NetUtil::getInetAddr </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>intf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取网口ip地址 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">intf</td><td>网口名称,如eth0 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>std::string IP地址字符串,获取失败返回空字符串 </dd></dl>

</div>
</div>
<a id="aa56ecf7efb5269453a0957c83ba0203c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa56ecf7efb5269453a0957c83ba0203c">&#9670;&nbsp;</a></span>getLinkState()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="_net_util_8h.html#a30af18f263a539852711bbd271e9a9d8">NetLinkState</a> libemb::NetUtil::getLinkState </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>intf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取网络连接状态 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">intf</td><td>网口名称,如eth0 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>NetLinkState 成功返回网口状态 </dd></dl>

</div>
</div>
<a id="a686ec370867d03c670eff586287acd38"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a686ec370867d03c670eff586287acd38">&#9670;&nbsp;</a></span>getMacAddr()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string libemb::NetUtil::getMacAddr </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>intf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取网口mac地址 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">intf</td><td>网口名称,如eth0 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>std::string mac地址字符串,获取失败返回空字符串 </dd></dl>

</div>
</div>
<a id="ad4bdfc20f3cc038fef56aba30899fd7e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad4bdfc20f3cc038fef56aba30899fd7e">&#9670;&nbsp;</a></span>getMaskAddr()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string libemb::NetUtil::getMaskAddr </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>intf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取网口子网掩码地址 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">intf</td><td>网口名称,如eth0 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>std::string IP地址字符串,获取失败返回空字符串 </dd></dl>

</div>
</div>
<a id="a0d989b9d5c1a2f7a52e54cfa7452b297"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0d989b9d5c1a2f7a52e54cfa7452b297">&#9670;&nbsp;</a></span>getSubnetIP()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">std::string libemb::NetUtil::getSubnetIP </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>gatewayIP</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>subnetMask</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>subIndex</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取子网IP </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">gatewayIP</td><td></td></tr>
    <tr><td class="paramname">subnetMask</td><td></td></tr>
    <tr><td class="paramname">subIndex</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>std::string </dd></dl>

</div>
</div>
<a id="a6fcc0212b4788d7c84b1d530b8e7cd51"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6fcc0212b4788d7c84b1d530b8e7cd51">&#9670;&nbsp;</a></span>isValidIP()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool libemb::NetUtil::isValidIP </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>ip</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>判断是否是合法IP </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ip</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true </dd>
<dd>
false </dd></dl>

</div>
</div>
<a id="a4072f4022df07fafd6627fbb250f444b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4072f4022df07fafd6627fbb250f444b">&#9670;&nbsp;</a></span>setHwState()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool libemb::NetUtil::setHwState </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>intf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="_net_util_8h.html#aa652d8a6638e8367e3aa0c8c005f847a">NetHwState</a>&#160;</td>
          <td class="paramname"><em>state</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>设置网口状态 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">intf</td><td></td></tr>
    <tr><td class="paramname">state</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true </dd>
<dd>
false </dd></dl>

</div>
</div>
<a id="a03ad01a91fa4506495d13a2e1f1df927"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a03ad01a91fa4506495d13a2e1f1df927">&#9670;&nbsp;</a></span>setInetAddr()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool libemb::NetUtil::setInetAddr </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>intf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>ipaddr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>设置网口IP </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">intf</td><td></td></tr>
    <tr><td class="paramname">ipaddr</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true </dd>
<dd>
false </dd></dl>

</div>
</div>
<a id="a07625066943cbfa53a6ce1bfbcb03924"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a07625066943cbfa53a6ce1bfbcb03924">&#9670;&nbsp;</a></span>setMacAddr()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool libemb::NetUtil::setMacAddr </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>intf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>mac</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>设置MAC地址 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">intf</td><td></td></tr>
    <tr><td class="paramname">mac</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true </dd>
<dd>
false </dd></dl>

</div>
</div>
<a id="a4bb38b696c79d1d00e28397efb50ad60"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4bb38b696c79d1d00e28397efb50ad60">&#9670;&nbsp;</a></span>setMaskAddr()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool libemb::NetUtil::setMaskAddr </td>
          <td>(</td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>intf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string&#160;</td>
          <td class="paramname"><em>netmask</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>设置子网掩码 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">intf</td><td></td></tr>
    <tr><td class="paramname">netmask</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true </dd>
<dd>
false </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>src/<a class="el" href="_net_util_8h_source.html">NetUtil.h</a></li>
<li>src/NetUtil.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
</html>
